package com.yanqu.road.server.cmd.activity.dafuweng;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.monopoly.MonopolyProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.DaFuWengDataMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C_CROSS_DA_FU_WENG_UPLOAD_DOLL, desc = "")
public class CrossDfwUploadDollCmd extends CrossUnionCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MonopolyProto.NotifyDollMoveMsg notifyDollMoveMsg = MonopolyProto.NotifyDollMoveMsg.parseFrom(packet.getBytes());
        int activityId = notifyDollMoveMsg.getActivityId();
        MonopolyProto.UnionMemberDollTemp dollMsg = notifyDollMoveMsg.getDollMsg();
        boolean isMove = notifyDollMoveMsg.getIsMove();
        String unionId = notifyDollMoveMsg.getUnionId();
        DaFuWengDataMgr.updateDoll(activityId,unionId,dollMsg,isMove);
        if (isMove) {
            DaFuWengDataMgr.addNotifyMoveMsg(activityId, notifyDollMoveMsg, groupId);
        }
    }

    @Override
    public void sendData() {

    }
}
